﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;

namespace AxeFrog.Data
{
	public static class IDataParameterExtensions
	{
		public static void SetValue(this IDataParameter prm, object val)
		{
			if(val == null)
				prm.Value = DBNull.Value;
			else if(val is Type)
				prm.Value = ((Type)val).GetMinimalAssemblyQualifiedName();
			else if(val is TimeSpan)
				prm.Value = ((TimeSpan)val).Ticks;
			else
				prm.Value = val;
		}
	}
}
